.class public Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;
.super Ljava/lang/Object;
.source "AnalyticsDBUtil.java"


# static fields
.field private static analyticsDBUtil:Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;


# instance fields
.field private final DATABASE_NAME:Ljava/lang/String;

.field private mContext:Landroid/content/Context;

.field private mDaoSession:Lcom/zuiapps/sdk/analytics/greendao/DaoSession;


# direct methods
.method private constructor <init>(Landroid/content/Context;)V
    .registers 7
    .param p1, "mContext"    # Landroid/content/Context;

    .prologue
    .line 26
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 24
    const-string v3, "com.zuimeia.sdk.analytics.db"

    iput-object v3, p0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;->DATABASE_NAME:Ljava/lang/String;

    .line 27
    iput-object p1, p0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;->mContext:Landroid/content/Context;

    .line 28
    new-instance v2, Lcom/zuiapps/sdk/analytics/db/DatabaseOpenHelper;

    const-string v3, "com.zuimeia.sdk.analytics.db"

    const/4 v4, 0x0

    invoke-direct {v2, p1, v3, v4}, Lcom/zuiapps/sdk/analytics/db/DatabaseOpenHelper;-><init>(Landroid/content/Context;Ljava/lang/String;Landroid/database/sqlite/SQLiteDatabase$CursorFactory;)V

    .line 29
    .local v2, "helper":Lcom/zuiapps/sdk/analytics/greendao/DaoMaster$OpenHelper;
    invoke-virtual {v2}, Lcom/zuiapps/sdk/analytics/greendao/DaoMaster$OpenHelper;->getWritableDatabase()Landroid/database/sqlite/SQLiteDatabase;

    move-result-object v1

    .line 30
    .local v1, "db":Landroid/database/sqlite/SQLiteDatabase;
    new-instance v0, Lcom/zuiapps/sdk/analytics/greendao/DaoMaster;

    invoke-direct {v0, v1}, Lcom/zuiapps/sdk/analytics/greendao/DaoMaster;-><init>(Landroid/database/sqlite/SQLiteDatabase;)V

    .line 31
    .local v0, "daoMaster":Lcom/zuiapps/sdk/analytics/greendao/DaoMaster;
    invoke-virtual {v0}, Lcom/zuiapps/sdk/analytics/greendao/DaoMaster;->newSession()Lcom/zuiapps/sdk/analytics/greendao/DaoSession;

    move-result-object v3

    iput-object v3, p0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;->mDaoSession:Lcom/zuiapps/sdk/analytics/greendao/DaoSession;

    .line 32
    return-void
.end method

.method public static declared-synchronized getInstance(Landroid/content/Context;)Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;
    .registers 3
    .param p0, "mContext"    # Landroid/content/Context;

    .prologue
    .line 35
    const-class v1, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;

    monitor-enter v1

    :try_start_3
    sget-object v0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;->analyticsDBUtil:Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;

    if-nez v0, :cond_e

    .line 36
    new-instance v0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;

    invoke-direct {v0, p0}, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;->analyticsDBUtil:Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;

    .line 38
    :cond_e
    sget-object v0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;->analyticsDBUtil:Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;
    :try_end_10
    .catchall {:try_start_3 .. :try_end_10} :catchall_12

    monitor-exit v1

    return-object v0

    .line 35
    :catchall_12
    move-exception v0

    monitor-exit v1

    throw v0
.end method


# virtual methods
.method public declared-synchronized delete(Ljava/util/List;)V
    .registers 3
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Lcom/zuiapps/sdk/analytics/greendao/AnalysisModel;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 67
    .local p1, "analysisList":Ljava/util/List;, "Ljava/util/List<Lcom/zuiapps/sdk/analytics/greendao/AnalysisModel;>;"
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;->mDaoSession:Lcom/zuiapps/sdk/analytics/greendao/DaoSession;

    invoke-virtual {v0}, Lcom/zuiapps/sdk/analytics/greendao/DaoSession;->getAnalysisModelDao()Lcom/zuiapps/sdk/analytics/greendao/AnalysisModelDao;

    move-result-object v0

    invoke-virtual {v0, p1}, Lcom/zuiapps/sdk/analytics/greendao/AnalysisModelDao;->deleteInTx(Ljava/lang/Iterable;)V
    :try_end_a
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_a} :catch_f
    .catchall {:try_start_1 .. :try_end_a} :catchall_c

    .line 71
    :goto_a
    monitor-exit p0

    return-void

    .line 67
    :catchall_c
    move-exception v0

    monitor-exit p0

    throw v0

    .line 68
    :catch_f
    move-exception v0

    goto :goto_a
.end method

.method public declared-synchronized queryList()Ljava/util/List;
    .registers 5
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<",
            "Lcom/zuiapps/sdk/analytics/greendao/AnalysisModel;",
            ">;"
        }
    .end annotation

    .prologue
    .line 55
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;->mDaoSession:Lcom/zuiapps/sdk/analytics/greendao/DaoSession;

    invoke-virtual {v0}, Lcom/zuiapps/sdk/analytics/greendao/DaoSession;->getAnalysisModelDao()Lcom/zuiapps/sdk/analytics/greendao/AnalysisModelDao;

    move-result-object v0

    invoke-virtual {v0}, Lcom/zuiapps/sdk/analytics/greendao/AnalysisModelDao;->queryBuilder()Lde/greenrobot/dao/query/QueryBuilder;

    move-result-object v0

    const/4 v1, 0x1

    new-array v1, v1, [Lde/greenrobot/dao/Property;

    const/4 v2, 0x0

    sget-object v3, Lcom/zuiapps/sdk/analytics/greendao/AnalysisModelDao$Properties;->Time:Lde/greenrobot/dao/Property;

    aput-object v3, v1, v2

    invoke-virtual {v0, v1}, Lde/greenrobot/dao/query/QueryBuilder;->orderDesc([Lde/greenrobot/dao/Property;)Lde/greenrobot/dao/query/QueryBuilder;

    move-result-object v0

    invoke-virtual {v0}, Lde/greenrobot/dao/query/QueryBuilder;->list()Ljava/util/List;
    :try_end_1a
    .catch Ljava/lang/Throwable; {:try_start_1 .. :try_end_1a} :catch_1d
    .catchall {:try_start_1 .. :try_end_1a} :catchall_20

    move-result-object v0

    .line 58
    :goto_1b
    monitor-exit p0

    return-object v0

    .line 56
    :catch_1d
    move-exception v0

    .line 58
    const/4 v0, 0x0

    goto :goto_1b

    .line 55
    :catchall_20
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized updateAnalysisModel(Lcom/zuiapps/sdk/analytics/greendao/AnalysisModel;)V
    .registers 5
    .param p1, "analysisModel"    # Lcom/zuiapps/sdk/analytics/greendao/AnalysisModel;

    .prologue
    .line 46
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lcom/zuiapps/sdk/analytics/db/AnalyticsDBUtil;->mDaoSession:Lcom/zuiapps/sdk/analytics/greendao/DaoSession;

    invoke-virtual {v0}, Lcom/zuiapps/sdk/analytics/greendao/DaoSession;->getAnalysisModelDao()Lcom/zuiapps/sdk/analytics/greendao/AnalysisModelDao;

    move-result-object v0

    const/4 v1, 0x1

    new-array v1, v1, [Lcom/zuiapps/sdk/analytics/greendao/AnalysisModel;

    const/4 v2, 0x0

    aput-object p1, v1, v2

    invoke-virtual {v0, v1}, Lcom/zuiapps/sdk/analytics/greendao/AnalysisModelDao;->insertOrReplaceInTx([Ljava/lang/Object;)V
    :try_end_10
    .catchall {:try_start_1 .. :try_end_10} :catchall_12

    .line 47
    monitor-exit p0

    return-void

    .line 46
    :catchall_12
    move-exception v0

    monitor-exit p0

    throw v0
.end method
